# coding: utf-8
# Project：PythonProject
# File：test3.py
# Author：罗若元
# Date ：2025/3/26 19:26
# IDE：PyCharm
import  math

print("***********计算机************")
print("*    作者：20241417罗若元    *")
print("*      时间：2025.3.26      *")
print("****************************")

def calculate1(num1,num2):
    return  num1 + num2
def calculate2(num1,num2):
    return  num1 - num2
def calculate3(num1,num2):
    return  num1 * num2
def calculate4(num1,num2):
    if num2 == 0:
        print("除数不能为0")
        return 0
    return  num1 / num2
def log(num1,num2):
    return math.log(num2,num1)

flag = True
while flag:
    if input("请问你需要复数(1)还是整数(2)运算？\n")=="1":
        num1 = complex(input("请输入一个数："))
        num2 = complex(input("请输入另一个数："))
    else:
        num1 = int(input("请输入一个数："))
        num2 = int(input("请输入另一个数："))
    choice = input("请输入运算符（+-*/log）：")
    if choice =="+":
        print("num1",choice,"num2 =",calculate1(num1, num2))
    elif choice =="-":
        print("num1",choice,"num2 =",calculate2(num1, num2))
    elif choice =="*":
        print("num1",choice,"num2 =",calculate3(num1, num2))
    elif choice =="/":
        print("num1",choice,"num2 =",calculate4(num1, num2))
    elif choice =="log":
        print("以",num1,"为底数 ，",num2,"为真数的对数 =",log(num1, num2))
    else:
        print("请输入正确的运算符")
    conti = input("是否继续（Y/N）：\n")
    if conti =="Y":
        flag = True
    else:
        flag = False
